Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
Why is react-font-picker gives error "Error: Cannot update active font: "Fira Sans" is not in the font list"?

I am using font picker in my project like this.

<FontPicker
                          apiKey={process.env.REACT_APP_GOOGLE_API_KEY}
                          activeFontFamily={activeFontFamilyMobile}
                          onChange={(nextFont) =>
                            setActiveFontFamilyMobile(nextFont.family)
                          }
                        />

The already saved font in stored in the backend, which I am fetching and setting up like this in use Effect:

            setActiveFontFamilyMobile(response.data.font_family);

and by default, the state is like this:

  const [activeFontFamilyMobile, setActiveFontFamilyMobile] = React.useState("Raleway");

So the problem is that when the page loads for the first time, saved font_family comes from the backend and is stored in activeFontFamilyMobile. And in the parameters of fontPicker, it should be displayed by activeFontFamily={activeFontFamilyMobile}. But it gives error like this: Error

But if I make some changes in the code and cause a re-render, it starts working. So its not working when the pages loads first time. What might be the issue?

almost 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda